/**
 * Copyright © 2020 易久批信息技术有限公司. All rights reserved.
 */
package com.dysm.adapter;

/**
 * 适配器模式
 * @author xiay
 * @since 2020/12/9 9:32 下午
 */
public class AdapterClient {

    public static void main(String[] args) {
        AdapterClient client = new AdapterClient();

        // 类适配器
        TargetInterface classAdapter = new ClassAdapter();
        client.requestWrite(classAdapter);

        // 对象适配器
        TargetInterface objectAdapter = new ObjectAdapter(new Adaptee());
        client.requestWrite(objectAdapter);
    }

    public void requestWrite(TargetInterface target) {
        target.request();
    }
}
